<%@ page language="java"
 import="com.jju.A1541.dao.*"
 import="java.util.*"
 import="com.jju.A1541.model.*"
 contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	//1.获得表单的输入
String zjr = request.getParameter("zjr");
String address = request.getParameter("address");
String xq = request.getParameter("xq");
zjr = new String(zjr.getBytes("ISO-8859-1"),"UTF-8");
address = new String(address.getBytes("ISO-8859-1"),"UTF-8");
xq = new String(xq.getBytes("ISO-8859-1"),"UTF-8");
//2.创建Jyjz实体类Jzjz对象并进行赋值
Jyzj obj = new Jyzj();
obj.setZjr(zjr);
obj.setAddress(address);
obj.setXq(xq);
//3.调用JyjzDAO完成实体对象的持久化--保存到数据库表中
int n = JyzjDAO.add(obj);
if(n>0){
	 request.getSession().setAttribute("zjr", zjr);
	out.print("<script>alert('发布成功！');window.location='index.jsp'</script>");
}else{
	out.print("<script>alert('发布失败！');window.location='collect.jsp'</script>");
}
%>